﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Jbe.TestSuite.Project.Applications;

namespace Jbe.TestSuite.Project.Presentation
{
    /// <summary>
    /// Interaction logic for ProjectView.xaml
    /// </summary>
    public partial class ProjectView : UserControl, IProjectView
    {
        public ProjectView()
        {
            InitializeComponent();
        }

        void searchTextBox_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Enter)
                ((ProjectViewPresentationModel)this.DataContext).SearchCommand.Execute(null);
        }

        void FileDropCommand(object sender, DragEventArgs e)
        {
            string[] files = (string[])e.Data.GetData("FileDrop");
            ((ProjectViewPresentationModel)this.DataContext).FileDrop(files);
        }

        private EventHandler clickHandlers;
        event EventHandler DoubleClick
        {
            add { clickHandlers += value; }
            remove { clickHandlers -= value; }
        }

        void OnItemMouseDoubleClick(object sender, MouseEventArgs e)
        {
            if (clickHandlers != null)
            {
                clickHandlers(sender, e);
            }
        }
    }
}
